From 15d043c5d239facb99fa776c100f520c350562fb Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 18 Sep 2015 02:04:10 +0200 Subject: [PATCH] gdk: Mark window surfaces as dirty before reading from them We do not know what happened to this surface outside of GDK. Especially for foreign windows, they will have been modified by external applications. So be on the safe side and tell Cairo to clear all its caches. https://bugzilla.gnome.org/show_bug.cgi?id=754952 --- gdk/gdkpixbuf-drawable.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c index 9fabf872c9..ae6e7dae8f 100644 --- a/gdk/gdkpixbuf-drawable.c +++ b/gdk/gdkpixbuf-drawable.c @@ -93,6 +93,14 @@ gdk_pixbuf_get_from_window (GdkWindow *src, g_return_val_if_fail (gdk_window_is_viewable (src), NULL); surface = _gdk_window_ref_cairo_surface (src); + + /* We do not know what happened to this surface outside of GDK. + * Especially for foreign windows, they will have been modified + * by external applications. + * So be on the safe side and: + */ + cairo_surface_mark_dirty (surface); + dest = gdk_pixbuf_get_from_surface (surface, src_x, src_y, width, height); -- 2.30.2